From: Guido Günther Date: Sun, 4 Jan 2026 12:07:23 +0000 (+0100) Subject: mixer-control: Use automatic cleanup in match_stream_with_devices X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2^2^2^2^2~20 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b1b0a93b53bffdca3f324fd273edf115feb595c9;p=gnome-shell.git mixer-control: Use automatic cleanup in match_stream_with_devices Simplifies the loop Signed-off-by: Guido Günther Origin: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/merge_requests/31 Bug: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/issues/34 Bug-Debian: https://bugs.debian.org/1126514 Applied-upstream: gnome-shell 50, commit:798230599950607ec285daecd070f5bcb28580e4 Gbp-Pq: Topic libgvc Gbp-Pq: Name mixer-control-Use-automatic-cleanup-in-match_stream_with_.patch --- diff --git a/subprojects/gvc/gvc-mixer-control.c b/subprojects/gvc/gvc-mixer-control.c index e326346a3..6d425ddba 100644 --- a/subprojects/gvc/gvc-mixer-control.c +++ b/subprojects/gvc/gvc-mixer-control.c @@ -1235,7 +1235,7 @@ match_stream_with_devices (GvcMixerControl *control, GvcMixerStreamPort *stream_port, GvcMixerStream *stream) { - GList *devices, *d; + g_autoptr (GList) devices = NULL; guint stream_card_id; guint stream_id; gboolean in_possession = FALSE; @@ -1245,12 +1245,12 @@ match_stream_with_devices (GvcMixerControl *control, devices = g_hash_table_get_values (GVC_IS_MIXER_SOURCE (stream) ? control->priv->ui_inputs : control->priv->ui_outputs); - for (d = devices; d != NULL; d = d->next) { + for (GList *d = devices; d != NULL; d = d->next) { GvcMixerUIDevice *device; guint device_stream_id; - gchar *device_port_name; - gchar *origin; - gchar *description; + g_autofree gchar *device_port_name = NULL; + g_autofree gchar *origin = NULL; + g_autofree gchar *description = NULL; GvcMixerCard *card; guint card_id; @@ -1295,15 +1295,10 @@ match_stream_with_devices (GvcMixerControl *control, } } - g_free (device_port_name); - g_free (origin); - g_free (description); - if (in_possession == TRUE) break; } - g_list_free (devices); return in_possession; }